package com.senken.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.senken.mapper.SkRoleMapper;
import com.senken.mapper.SkUserRoleMapper;
import com.senken.entity.SkRole;
import com.senken.service.ISkRoleService;
import com.baomidou.framework.service.impl.SuperServiceImpl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;

/**
 *
 * SkRole 表数据服务层接口实现类
 *
 */
@Service
public class SkRoleServiceImpl extends SuperServiceImpl<SkRoleMapper, SkRole> implements ISkRoleService {

	@Autowired
	private SkUserRoleMapper userrolemapper;
	@Autowired
	private SkRoleMapper rolemapper;
	
	@Override
	public List<Integer> selectRoleIdByUserId(int user_id) {
		return userrolemapper.selectRoleIdByUserId(user_id);
	}

	@Override
	public List<Map<Long, String>> selectResourceListByRoleId(int id) {
		return rolemapper.selectResourceListByRoleId(id);
	}

	@Override
	public List<SkRole> findAllRole(){
		SkRole role = new SkRole();
		return this.selectList(new EntityWrapper<SkRole>(role));
	}
	
	@Override
	public List<SkRole>findroleByState(int state){
		SkRole role = new SkRole();
		role.setState(state);
		return this.selectList(new EntityWrapper<SkRole>(role));
	}
	
}